<template>
  <div>
    <template v-if="info.showFlag ==12 ||info.type === 0">
      <div class="send-text" :class="{'color-active':isMine}">
        <div class="quote-original" :class="{'color-active':isMine}">{{info.originalMessage}}</div>
      </div>
    </template>
  </div>
</template>
<script>
export default {
  data() {
    return {
      info: {},
      showjudge: false,
      showuserfiles: false
    };
  },
  mounted() {
    var self = this;
    var djson = JSON.parse(self.payload.data);
    if (!djson.type && djson.type !== 0) {
      djson.type = 0;
      if (!djson.info) {
        djson.info = [];
      }

      for (var i = 0; i < djson.info.length; i++) {
        if (djson.info[i].identity == self.userID && !self.isMine) {
          var nickname = "@" + djson.info[i].nickname;
          var reg = new RegExp(nickname, "g");
          djson.content = djson.content.replace(
            reg,
            "<span class='at-color'>" + nickname + "</span>"
          );
        }
      }
    } else {
    }

    //引用使用
    if (djson.type == 12) {
      djson.showFlag = 12;
    }

    self.info = djson;
  },
  props: {
    payload: {
      type: Object,
      required: true
    },
    message: {
      type: Object,
      required: true
    },
    isMine: {
      type: Boolean
    }
  }
};
</script>
<style lang="stylus" scoped>
.quote-original {
  background: #e6e6f8;
  padding: 10px;
  margin-top: 10px;
  line-height: 20px;
  font-size: 0.32rem;
  border-radius: 8px;
  color: #3d3d3d; 
}
 
</style>

